<script type="text/javascript">

    
$(document).ready(function() {  
    $( "#tabs" ).tabs({
        beforeLoad: function( event, ui ) {
            ui.jqXHR.error(function() {
                ui.panel.html(
                    "Couldn't load this tab. We'll try to fix this as soon as possible. " +
                    "If this wouldn't be a demo." );
            });
        },
        load: function( event, ui ) {
            accordion();
        }
    }).addClass( "ui-tabs-vertical ui-helper-clearfix" );
    //$( "#tabs" ).tabs().addClass( "ui-tabs-vertical ui-helper-clearfix" );
    $( "#tabs li[rel=vertical]" ).removeClass( "ui-corner-top" ).addClass( "ui-corner-left" );

    $( ".datepicker" ).datepicker({
        dateFormat: "dd-mm-yy",
        showOn: "button",
        buttonImage: "<?php print base_url('template/ess/images/calendar_icon.gif'); ?>",
        buttonImageOnly: true,
        changeMonth: true,
        changeYear: true,
        monthNamesShort: [ "<?php print lang('monthshort_jan'); ?>", "<?php print lang('monthshort_feb'); ?>", "<?php print lang('monthshort_mar'); ?>", "<?php print lang('monthshort_apr'); ?>", "<?php print lang('monthshort_maj'); ?>", "<?php print lang('monthshort_jun'); ?>", "<?php print lang('monthshort_jul'); ?>", "<?php print lang('monthshort_aug'); ?>", "<?php print lang('monthshort_sep'); ?>", "<?php print lang('monthshort_okt'); ?>", "<?php print lang('monthshort_nov'); ?>", "<?php print lang('monthshort_dec'); ?>" ],
        dayNamesMin: [ "<?php print lang('dayshort_sun'); ?>", "<?php print lang('dayshort_mon'); ?>", "<?php print lang('dayshort_tue'); ?>", "<?php print lang('dayshort_wed'); ?>", "<?php print lang('dayshort_thu'); ?>", "<?php print lang('dayshort_fri'); ?>", "<?php print lang('dayshort_sat'); ?>" ]
    });
    accordion();
} );
function submitFormReportDate(){
    $('#frm_report_date').submit();
}
function accordion(){
    $( ".accordion" ).accordion({
        heightStyle: "content",
        //collapsible: true
    });
    $( ".accordion" ).find('.ui-accordion-content').removeClass('ui-accordion-content').addClass('ui-accordion-moc');
}
</script>

<style>
    .ui-tabs-vertical {}
    .ui-tabs-vertical .ui-tabs-nav { padding: .2em .1em .2em .2em; float: left; width: 12em; }
    .ui-tabs-vertical .ui-tabs-nav li { clear: left; width: 100%; border-bottom-width: 1px !important; border-right-width: 0 !important; margin: 0 -1px .2em 0; }
    .ui-tabs-vertical .ui-tabs-nav li a { display:block; }
    .ui-tabs-vertical .ui-tabs-nav li.ui-tabs-active { padding-bottom: 0; padding-right: .1em; border-right-width: 1px; border-right-width: 1px; }
    .ui-tabs-vertical .ui-tabs-panel { padding: 1em; float: right; width: 805px;}
    
    .ui-accordion-moc{
        border-top: 0 none;
        overflow: auto;
        padding: 1em 0.2em;
    }
</style>

<div class="page-title 1ui-widget-header">
    <form id="frm_report_date" action="<?php print site_url('rp/report'); ?>" method="post">
        <p>
            <label><?php print lang('vt_tungay'); ?></label>: <input type="text" name="report_date_from" value="<?php print $report_date_from; ?>" id="report_date_from" class="datepicker" />
            <label><?php print lang('vt_denngay'); ?></label>: <input type="text" name="report_date_to" value="<?php print $report_date_to; ?>" id="report_date_to" class="datepicker" />
            <button onclick="submitFormReportDate()";><?php print lang('btn_filter'); ?></button>
        </p>
    </form>
</div>
<?php if( isset($report_date) && isset($data_total) ): ?>
<div class="menu-button">
    <div class="message"></div>
    <!--<button onclick="even_add();"><?php print lang('btn_new'); ?></button>
    <button onclick="even_edit();"><?php print lang('btn_edit'); ?></button>
    <button onclick="even_delete();"><?php print lang('btn_delete'); ?></button>-->
    <div class="clear"></div>
</div>

<div class="warpp">

    <div id="tabs">
        <ul>
            <li rel="vertical"><a href="#tabs-tk"><?php print lang('vt_thongke'); ?></a></li>
            <?php foreach($report_date As $item): ?>
            <li rel="vertical"><a href="<?php print site_url('rp/ajax_reportdate/'.$item); ?>"><?php print dateMysqlToVN($item); ?></a></li>
            <?php endforeach; ?>
        </ul>
        <div id="tabs-tk">
            <div class="accordion">
                <?php if(isset($data_import)): ?>
                <h3><?php print lang('vt_tkngaynhapkho');?></h3>
                <div>
                    <table cellpadding="0" cellspacing="0" border="0" class="display">
                        <thead>
                            <tr>
                                <th class="ui-state-default"><?php print lang('vt_ngaynhap'); ?></th>
                                <th class="ui-state-default"><?php print lang('vt_total-vat');?></th>
                                <th class="ui-state-default"><?php print lang('vt_total+vat'); ?></th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php $j=0; $total_novat = 0;$total_vat = 0;?>
                            <?php foreach($data_import As $imp): ?>
                            <tr class="<?php print ( $j%2 == 0 ) ? 'odd':'even'; ?>">
                                <td><?php print dateMysqlToVN($imp['date']); ?></td>
                                <td><?php print formatMoney($imp['total_novat']); ?></td>
                                <td><?php print formatMoney($imp['total_vat']); ?></td>
                            </tr>
                            <?php
                                $j++;
                                $total_novat += $imp['total_novat'];
                                $total_vat += $imp['total_vat'];
                            ?>
                            <?php endforeach; ?>
                        </tbody>
                        <tfoot>
                            <tr>
                                <th class="ui-state-default"><?php print lang('vt_tongtien'); ?></th>
                                <th class="ui-state-default"><?php print formatMoney($total_novat); ?></th>
                                <th class="ui-state-default"><?php print formatMoney($total_vat); ?></th>
                            </tr>
                        </tfoot>
                    </table>
                </div>
                <?php endif; ?>
                
                <?php if(isset($data_export)): ?>
                <h3><?php print lang('vt_tkngayxuatkho');?></h3>
                <div>
                    <table cellpadding="0" cellspacing="0" border="0" class="display">
                        <thead>
                            <tr>
                                <th class="ui-state-default"><?php print lang('vt_ngayxuat'); ?></th>
                                <th class="ui-state-default"><?php print lang('vt_total-vat');?></th>
                                <th class="ui-state-default"><?php print lang('vt_total+vat'); ?></th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php $k=0; $total_novatx = 0;$total_vatx = 0;?>
                            <?php foreach($data_export As $exp): ?>
                            <tr class="<?php print ( $k%2 == 0 ) ? 'odd':'even'; ?>">
                                <td><?php print dateMysqlToVN($exp['date']); ?></td>
                                <td><?php print formatMoney($exp['total_novat']); ?></td>
                                <td><?php print formatMoney($exp['total_vat']); ?></td>
                            </tr>
                            <?php
                                $k++;
                                $total_novatx += $exp['total_novat'];
                                $total_vatx += $exp['total_vat'];
                            ?>
                            <?php endforeach; ?>
                        </tbody>
                        <tfoot>
                            <tr>
                                <th class="ui-state-default"><?php print lang('vt_tongtien'); ?></th>
                                <th class="ui-state-default"><?php print formatMoney($total_novatx); ?></th>
                                <th class="ui-state-default"><?php print formatMoney($total_vatx); ?></th>
                            </tr>
                        </tfoot>
                    </table>
                </div>
                <?php endif; ?>
                
                <?php if( isset($report_revert) ): ?>
                <h3><?php print lang('vt_tkngayvttralai'); ?></h3>
                <div>
                    <table cellpadding="0" cellspacing="0" border="0" class="display" id="" active_url="">
                        <thead>
                            <tr>
                                <th class="ui-state-default"><?php print lang('vt_stt'); ?></th>
                                <th class="ui-state-default"><?php print lang('vt_mavt'); ?></th>
                                <th class="ui-state-default"><?php print lang('vt_tenvt'); ?></th>
                                <th class="ui-state-default"><?php print lang('vt_donvitinh'); ?></th>
                                <th class="ui-state-default"><?php print lang('vt_slxuat'); ?></th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php $l = 1; ?>
                            <?php foreach($report_revert As $re): ?>
                            <tr class="<?php print ( $l%2 == 0 ) ? 'even':'odd'; ?>">
                                <td><?php print $l; ?></td>
                                <td><?php print $re['code']; ?></td>
                                <td><?php print $re['name']; ?></td>
                                <td><?php print $re['value']; ?></td>
                                <td><?php print $re['total']; ?></td>
                            </tr>
                            <?php $l++; ?>
                            <?php endforeach; ?>
                        </tbody>
                    </table>
                </div>
                <?php endif; ?>
                
                <h3><?php print lang('vt_tkvattu'); ?></h3>
                <div>
                    <table cellpadding="0" cellspacing="0" border="0" class="display" id="" active_url="">
                        <thead>
                            <tr>
                                <th class="ui-state-default"><?php print lang('vt_stt'); ?></th>
                                <th class="ui-state-default"><?php print lang('vt_mavt'); ?></th>
                                <th class="ui-state-default"><?php print lang('vt_tenvt'); ?></th>
                                <th class="ui-state-default"><?php print lang('vt_donvitinh'); ?></th>
                                <th class="ui-state-default"><?php print lang('vt_slbandau'); ?></th>
                                <th class="ui-state-default"><?php print lang('vt_slxuat'); ?></th>
                                <th class="ui-state-default"><?php print lang('vt_slnhap'); ?></th>
                                <th class="ui-state-default"><?php print lang('vt_sltra'); ?></th>
                                <th class="ui-state-default"><?php print lang('vt_sltonkho'); ?></th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php $i = 1; ?>
                            <?php foreach($data_total As $row): ?>
                            <tr class="<?php print ( $i%2 == 0 ) ? 'even':'odd'; ?>">
                                <td><?php print $i; ?></td>
                                <td><?php print $row['code']; ?></td>
                                <td><?php print $row['name']; ?></td>
                                <td><?php print $row['value']; ?></td>
                                <td><?php print $row['first_total']; ?></td>
                                <td><?php print $row['export']; ?></td>
                                <td><?php print $row['import']; ?></td>
                                <td><?php print $row['revert']; ?></td>
                                <td><?php print $row['last_total']; ?></td>
                            </tr>
                            <?php $i++; ?>
                            <?php endforeach; ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
    
    
</div>
<?php endif; ?>
<!--<div id="dialog_form_add" title="<?php print lang('vt_title_themdvt'); ?>" active_url="<?php print site_url('vt/ajax_loadfrm_dvt/'); ?>"></div>
<div id="dialog_form_edit" title="<?php print lang('vt_title_suadvt'); ?>" active_url="<?php print site_url('vt/ajax_loadfrm_dvt/'); ?>"></div>
<div id="dialog_confrim_delete" title="<?php print lang('title_thongbao'); ?>" active_url="<?php print site_url('vt/delete_dvt/'); ?>">
    <p><?php print lang('msg_delete'); ?></p>
</div>
-->